package com.example.design.c.construct;

public class Student {
    private int id;
    private String name;
    private String passwd;
    private String sex;
    private String address;

    private Student(){

    }

    private Student(Student origin){
        // 拷贝一份
        this.id = origin.id;
        this.name = origin.name;
        this.passwd = origin.passwd;
        this.sex = origin.sex;
        this.address = origin.address;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPasswd() {
        return passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public static class Builder{
        private Student target;

        public Builder(){
            target=new Student();
        }

        public Builder id(int id){
            target.id=id;
            return this;
        }

        public Builder address(String address){
            target.address=address;
            return this;
        }

        public Builder name(String name){
            target.name=name;
            return this;
        }

        public Builder passwd(String passwd){
            target.passwd=passwd;
            return this;
        }

        public Builder sex(String sex){
            target.sex=sex;
            return this;
        }

        public Student build(){
            return new Student(target);
        }
    }
}
